// Bristleback plugin - Copyright (c) 2010 bristleback.googlecode.com
// ---------------------------------------------------------------------------
// This program is free software; you can redistribute it and/or modify it
// under the terms of the GNU Lesser General Public License as published by the
// Free Software Foundation; either version 3 of the License, or (at your
// option) any later version.
// This library is distributed in the hope that it will be useful,
// but without any warranty; without even the implied warranty of merchantability
// or fitness for a particular purpose.
// You should have received a copy of the GNU Lesser General Public License along
// with this program; if not, see <http://www.gnu.org/licenses/lgpl.html>.
// ---------------------------------------------------------------------------
package pl.bristleback.server.bristle.actions;

import org.jwebsocket.api.WebSocketConnector;
import org.jwebsocket.token.Token;

/**
 * Classes implementing this interface are used to executing user actions.
 * Plugin will create one instance of every action class and bind all information into {@link RemoteActionInformation} object.
 * This interface determines only what operations will be made. To obtain fully implemented action class,
 * mark that class with {@link pl.bristleback.server.bristle.actions.AnnotatedRemoteAction} annotation.
 * Action class may be taken from Spring Framework application context. To do so,
 * application context must be set using {@link pl.bristleback.server.bristle.integration.spring.SpringIntegrationUtil} (standalone application)
 * or by adding context parameter {@code "bristlePluginEnableSpring"} with value set to {@code "true"} (web application).
 * For more detailed information about Spring support, please refer to {@link pl.bristleback.server.bristle.integration.spring.SpringIntegrationUtil} class documentation.
 *
 * @author Wojciech Niemiec
 * @see pl.bristleback.server.bristle.actions.AnnotatedRemoteAction AnnotatedRemoteAction
 */
public interface RemoteAction {

  /**
   * Performs action requested by user/connector.
   *
   * @param connector user requesting this action.
   * @param token     content of message, can be seen as action parameters.
   */
  void performAction(WebSocketConnector connector, Token token);
}
